package com.sunxd.zstudy.java8.lambda;

import java.util.function.Supplier;

/**
 * @author sun.xd
 * @description: description
 * @date 2023/11/14 17:36
 */
public class TSupplier {

    public static void main(String[] args) {

        // 匿名内部类的实现
        Supplier<String> supplier1 = new Supplier<String>() {
            @Override
            public String get() {
                return "abc";
            }
        };
        String s1 = supplier1.get();
        System.out.println(s1);

        // lambda  实现
        Supplier<String> supplier2 = () -> "abc";
        String s2 = supplier2.get();
        System.out.println(s2);
    }
}
